package org.gy.T9;

import java.io.*;

public class BufferedInputStreamTest1 {
    public static void main(String[] args) {
        try (
                InputStream is = new FileInputStream("C:/file-io-app2/src/itheima01.txt");
// 1、定义⼀个字节缓冲输⼊流包装原始的字节输⼊流
                InputStream bis = new BufferedInputStream(is);
                OutputStream os = new FileOutputStream("C:/file-io-app2/src/itheima01_bak.txt");
// 2、定义⼀个字节缓冲输出流包装原始的字节输出流
                OutputStream bos = new BufferedOutputStream(os);
        ){
            byte[] buffer = new byte[1024];
            int len;
            while ((len = bis.read(buffer)) != -1){
                bos.write(buffer, 0, len);
            }
            System.out.println("复制完成！！");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
